<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>会员信息</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="../../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/util/utils.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			} 
			
			.mui-views,
			.mui-view,
			.mui-pages,
			.mui-page,
			.mui-page-content {
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				width: 100%;
				height: 100%;
				background-color: #efeff4;
			}
			
			.mui-pages {
				top: 46px;
				height: auto;
			}
			
			.mui-scroll-wrapper,
			.mui-scroll {
				background-color: #efeff4;
			}
			
			.mui-page.mui-transitioning {
				-webkit-transition: -webkit-transform 300ms ease;
				transition: transform 300ms ease;
			}
			
			.mui-page-left {
				-webkit-transform: translate3d(0, 0, 0);
				transform: translate3d(0, 0, 0);
			}
			
			.mui-ios .mui-page-left {
				-webkit-transform: translate3d(-20%, 0, 0);
				transform: translate3d(-20%, 0, 0);
			}
			
			.mui-navbar {
				position: fixed;
				right: 0;
				left: 0;
				z-index: 10;
				height: 44px;
				background-color: #f7f7f8;
			}
			
			.mui-navbar .mui-bar {
				position: absolute;
				background: transparent;
				text-align: center;
			}
			
			.mui-android .mui-navbar-inner.mui-navbar-left {
				opacity: 0;
			}
			
			.mui-ios .mui-navbar-left .mui-left,
			.mui-ios .mui-navbar-left .mui-center,
			.mui-ios .mui-navbar-left .mui-right {
				opacity: 0;
			}
			
			.mui-navbar .mui-btn-nav {
				-webkit-transition: none;
				transition: none;
				-webkit-transition-duration: .0s;
				transition-duration: .0s;
			}
			
			.mui-navbar .mui-bar .mui-title {
				display: inline-block;
				width: auto;
			}
			
			.mui-page-shadow {
				position: absolute;
				right: 100%;
				top: 0;
				width: 16px;
				height: 100%;
				z-index: -1;
				content: '';
			}
			
			.mui-page-shadow {
				background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
				background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
			}
			
			.mui-navbar-inner.mui-transitioning,
			.mui-navbar-inner .mui-transitioning {
				-webkit-transition: opacity 300ms ease, -webkit-transform 300ms ease;
				transition: opacity 300ms ease, transform 300ms ease;
			}
			
			.mui-page {
				display: none;
			}
			
			.mui-pages .mui-page {
				display: block;
			}
			
			.mui-page .mui-table-view:first-child {
				margin-top: 15px;
			}
			
			.mui-page .mui-table-view:last-child {
				margin-bottom: 30px;
			}
			
			.mui-table-view {
				margin-top: 20px;
			}
			
			.mui-table-view span.mui-pull-right {
				color: #999;
			}
			
			.mui-table-view .mui-pull-right {
				color: #999;
				display: block;
				margin-top: -6px;
			}
			
			.mui-table-view-divider {
				background-color: #efeff4;
				font-size: 14px;
			}
			
			.mui-table-view-divider:before,
			.mui-table-view-divider:after {
				height: 0;
			}
			
			.head {
				height: 40px;
			}
			
			#head {
				line-height: 40px;
			}
			
			.head-img {
				width: 40px;
				height: 40px;
			}
			
			#head-img1 {
				position: absolute;
				bottom: 10px;
				right: 40px;
				width: 40px;
				height: 40px;
			}
			
			.update {
				font-style: normal;
				color: #999999;
				margin-right: -25px;
				font-size: 15px
			}
			
			.mui-fullscreen {
				position: fixed;
				z-index: 20;
				background-color: #000;
			}
			
			.mui-ios .mui-navbar .mui-bar .mui-title {
				position: static;
			}
			/*问题反馈在setting页面单独的css*/
			
			#feedback .mui-popover {
				position: fixed;
			}
			
			#feedback .mui-table-view:last-child {
				margin-bottom: 0px;
			}
			
			#feedback .mui-table-view:first-child {
				margin-top: 0px;
			}
			/*问题反馈在setting页面单独的css==end*/
			
			select option{
				direction: rtl;
			}
			
			.mui-bar .mui-btn-link {
			    color: #00A8C6;
			}
		</style>
	</head>

	<body class="mui-fullscreen" style="background-color: white;">
		<!--页面主结构开始-->
		<div id="app" class="mui-views">
			<div class="mui-view">
				<div class="mui-navbar">
				</div>
				<div class="mui-pages">
				</div>
			</div>
		</div>
		<!--页面主结构结束-->
		<!--单页面开始-->
		<div id="dv-myInfo" class="mui-page">
			<!--页面标题栏开始-->
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>
				</button>
				<h1 class="mui-center mui-title">会员信息</h1>
			</div>
			<!--页面标题栏结束-->
			<!--页面主内容区开始-->
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll">
					
						<ul class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<a href="#myInfo" class="mui-navigate-right">我的资料</a>
							</li>
						</ul>
						<ul class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<a href="#bigBaby" class="mui-navigate-right">大宝信息</a>
							</li>
							<li class="mui-table-view-cell">
								<a href="#twoBaby" class="mui-navigate-right">二宝信息</a>
							</li>
							<li class="mui-table-view-cell">
								<a href="#threeBaby" class="mui-navigate-right">三宝信息</a>
							</li>
						</ul>
					
					</div>
				</div>
			</div>
			<!--页面主内容区结束-->
		</div>
		<!--单页面结束-->
		<div id="myInfo" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left" style="color: #00A8C6;">
					<span class="mui-icon mui-icon-left-nav"></span>会员信息
				</button>
				<h1 class="mui-center mui-title">个人信息</h1>
			</div>
			<div class="mui-page-content">
				
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" style="background-color: white;">
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">家长身份</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; color: #909090;"><select id="sel_famIdentity" style="font-size: 14px; padding: 0px;">
									<option value="父亲">父亲</option>
									<option value="母亲">母亲</option>
								</select></span>
								<span style="display: block; margin-top: 2px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">姓名</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; margin-top: 0px;">
									<input id="ipt_famName" style="text-align: right; padding: 0px; border: 0px; height: 22px; font-size: 14px; color: #909090;" type="text"></span>
								<span style="display: block; margin-top: 0px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">昵称</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; margin-top: 0px;">
									<input id="ipt_famNick" style="text-align: right; padding: 0px; border: 0px; height: 22px; font-size: 14px; color: #909090;" type="text"></span>
								<span style="display: block; margin-top: 0px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">职业</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; color: #909090; direction: rtl;"><select id="ipt_famJob" style="font-size: 14px; padding: 0px;">
									<option value="ZYLB_QXZ">请选择职业</option>
									<option value="ZYLB_GWY">公务员</option>
									<option value="ZYLB_JS">教师</option>
									<option value="ZYLB_QYZ">企业主</option>
									<option value="ZYLB_QYZGCGL">企业中高层管理</option>
									<option value="ZYLB_QYYXCZRY">企业一线操作人员</option>
									<option value="ZYLB_ZYJSRY">专业技术人员</option>
									<option value="ZYLB_ZYZYZ">自由职业者</option>
									<option value="ZYLB_QT">其他</option>
								</select></span>
								<span style="display: block; margin-top: 2px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">生日</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block;">
									<button id="ipt_famAge" style="height: 24px; font-size: 14px; color: #909090; margin-top: -5px; text-align: right; border:0; padding-right: 0px;" data-options='{"type":"date","beginYear":1914,"endYear":2116}'>选择日期</button>
								</span>
								<span style="display: block; margin-top: 0px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">教育程度</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; color: #909090;"><select id="ipt_famEdu" style="font-size: 14px; padding: 0px;">
									<option value="EDU_CZJYX">初中及以下</option>
									<option value="EDU_GZZZ">高中/中专</option>
									<option value="EDU_DX">大学</option>
									<option value="EDU_SSJYS">硕士及以上</option>
								</select></span>
								<span style="display: block; margin-top: 2px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 10px; height: 30px; padding-top: 4px;">
							<span style="display: block; float: left; margin-left: 10px; color: #616161;">年收入</span>
							<div style="float: right; margin-right: 10px; margin-top: -4px; display: flex;">
								<span style="display: block; color: #909090;"><select id="ipt_famIncome" style="font-size: 14px; padding: 0px;">
									<option value="5WYX">5万以下</option>
									<option value="5~10W">5~10万</option>
									<option value="10~20W">10~20万</option>
									<option value="20~50W">20~50万</option>
									<option value="5WYS">50万以上</option>
								</select></span>
								<span style="display: block; margin-top: 2px; margin-left: 20px;">
									<img src="../../img/right.png" style="width: 8px;"/>
								</span>
							</div> 
						</div>
						<hr class="levline" />
						
						<div style="margin-top: 20px; text-align: center;">
							<button id="btn_saveInfo" style="background-color: #00A8C6; width: 80%; height: 40px; font-size: 17px; color: #FFFFFF;">保存</button>
						</div>
					</div>
				</div>
				
			</div>
			
		</div>
		
		
		
		<div id="bigBaby" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>会员信息
				</button> 
				<h1 class="mui-center mui-title">大宝信息</h1>
			</div>
			<input type="hidden" id="bigBabyId" value="" />
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" style="background-color: white;">
						<embed id="ifrBabyOne" style="width: 100%; height: 560px;"></embed>
					</div>
				</div>
			</div>
		</div>
	
		<div id="twoBaby" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>个人信息
				</button>
				<h1 class="mui-center mui-title">二宝信息</h1>
			</div>
			<input type="hidden" id="TwoBabyId" value="" />
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" style="background-color: white;">
						<embed id="ifrBabyTwo" style="width: 100%; height: 560px;"></embed>
					</div>
				</div>
			</div>
		</div>
		<div id="threeBaby" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>个人信息
				</button>
				<h1 class="mui-center mui-title">三宝信息</h1>
			</div>
			<input type="hidden" id="threeBodyId" value="" />
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" style="background-color: white;">
						<embed id="ifrBabyThree" style="width: 100%; height: 560px;"></embed>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/mui.view.js"></script>
	<script src="../../js/mui.picker.min.js"></script>
	<script src="../../js/utils/http.utils.js"></script>
	<script src="../../js/jquery-1.8.3.min.js"></script>
	<script>
		mui.init();
		var viewApi = mui('#app').view({
			defaultPage: '#dv-myInfo'
		});
		mui('.mui-scroll-wrapper').scroll();
		
		var view = viewApi.view;
		(function($) {
			var oldBack = $.back;
			$.back = function() {
				if(viewApi.canBack()) { 
					viewApi.back();
				} else { 
					oldBack();
				}
			};
			view.addEventListener('pageBeforeShow', function(e) {
			});
			view.addEventListener('pageShow', function(e) {
				
			});
			view.addEventListener('pageBeforeBack', function(e) {
			});
			view.addEventListener('pageBack', function(e) {
			});
		})(mui);
		
	</script>

	<script>
		(function($) {
			$.init();
			
			document.getElementById("ipt_famAge").addEventListener('tap', function() {
					var optionsJson = this.getAttribute('data-options') || '{}';
					var options = JSON.parse(optionsJson);
					var id = this.getAttribute('id');
					var picker = new $.DtPicker(options);
					picker.show(function(rs) {
						document.getElementById("ipt_famAge").innerHTML = rs.text;
						picker.dispose();
					});
			}, false);
			
		})(mui);
	</script>

	<script>
		var $jz_uid;

		var $fam_info = JSON.parse(localStorage.getItem("login-user-parent"));
		var $news_fam_info;
		window.onload = function(){
			
			$jz_uid = $fam_info.userId;
			
			mui.ajax({
				url : $request_url.getUserInfo,
				headers: {
					"Authorization": $headers_authorization
				},
				type : "get",
				dataType : "json",
				data : {
					userId : $jz_uid
				},
				success : function(dat){
					var $bbid = "0";
					if(dat.code == 0){
						$news_fam_info = dat.result;
						document.getElementById("ipt_famName").value = $news_fam_info.trueName;
						document.getElementById("ipt_famNick").value = $news_fam_info.nickName;
						document.getElementById("ipt_famJob").value = $news_fam_info.profession;
						document.getElementById("ipt_famAge").innerHTML = $news_fam_info.birthday;
						document.getElementById("ipt_famEdu").value = $news_fam_info.eduction;
						document.getElementById("ipt_famIncome").value = $news_fam_info.incomePerYear;
						document.getElementById("sel_famIdentity").value = $news_fam_info.fatherOrMother;
						if($news_fam_info.children != null && $news_fam_info.children.length > 0){
							var $childNum = $news_fam_info.children.length;
							switch ($childNum){
								case "1":
									$bbid = $news_fam_info.children[0].id;
									break;
								case "2":
									$bbid = $news_fam_info.children[1].id;
									break;
								case "3":
									$bbid = $news_fam_info.children[2].id;
									break;
								default:
									break;
							}
						}
					} else {
						$news_fam_info = $fam_info;
					}
					
					document.getElementById("ifrBabyOne").setAttribute("src", "plugin/baby.html?baby=0&babyId=" + $bbid);
					document.getElementById("ifrBabyTwo").setAttribute("src", "plugin/baby.html?baby=1&babyId=" + $bbid);
					document.getElementById("ifrBabyThree").setAttribute("src", "plugin/baby.html?baby=2&babyId=" + $bbid);
				}, error : function(err){
					
				}
			});
			
		}
		
		document.getElementById("btn_saveInfo").addEventListener("tap", function(){
			mui.toast("好哈有....");
			var $myIdentity = document.getElementById("sel_famIdentity").value;
			var $myName = document.getElementById("ipt_famName").value;
			var $myNickName = document.getElementById("ipt_famNick").value;
			var $myJob = document.getElementById("ipt_famJob").value;
			var $myAge = document.getElementById("ipt_famAge").innerHTML;
			var $myEdu = document.getElementById("ipt_famEdu").value;
			var $myIncome = document.getElementById("ipt_famIncome").value;
			mui.ajax({
				url : $request_url.updateUserInfo,
				headers: {
					"Authorization": $headers_authorization
				},
				type : "post",
				dataType : "json",
				data : {
					userId : $jz_uid,
					trueName : $myName,
					nickName : $myNickName,
					incomePerYear : $myIncome,
					eduction : $myEdu,
					birthday : $myAge,
					profession : $myJob,
					fatherOrMother : $myIdentity
				},
				success : function(dat){
					if(dat.code == 0){
						mui.toast("个人信息更新成功!");
					}
				}, error : function(err){
					
				}
			});
			
		});
		
	</script>
</html>